﻿using UnityEngine;
using UnityEngine.Rendering;
using UnityEngine.Rendering.Universal;


[System.Serializable, VolumeComponentMenu("Lch/LchExponentialHeightFog")]
public class LchExponentialHeightFog : VolumeComponent, IPostProcessComponent
{
    public BoolParameter enable = new BoolParameter(false);

  
    // 雾 1
    [Header("雾浓度")]
    public ClampedFloatParameter fogDensity = new ClampedFloatParameter(0.02f, 0.0f, 0.05f);

    [Header("雾高度衰减系数")]
    public ClampedFloatParameter fogHeightFalloff = new ClampedFloatParameter(0.2f, 0.001f, 1.0f);

    [Header("雾高度")]
    public FloatParameter fogHeight = new FloatParameter(0.0f);

    [HideInInspector]
    // 雾 2
    [Header("雾浓度 2")]
    public ClampedFloatParameter fogDensity2 = new ClampedFloatParameter(0.02f, 0.0f, 0.05f);

    [HideInInspector]
    [Header("雾高度衰减系数 2")]
    public ClampedFloatParameter fogHeightFalloff2 = new ClampedFloatParameter(0.2f, 0.001f, 0.1f);

    [HideInInspector]
    [Header("雾高度 2")]
    public FloatParameter fogHeight2 = new FloatParameter(0.0f);

    // 颜色和不透明度
    [Header("雾色")]
    public ColorParameter fogInscatteringColor = new ColorParameter(new Color(0.447f, 0.639f, 1.0f));

    [Header("雾最大不透明度")]
    public ClampedFloatParameter fogMaxOpacity = new ClampedFloatParameter(1.0f, 0.0f, 1.0f);

    [Header("雾开始距离")]
    public FloatParameter startDistance = new FloatParameter(0.0f);

    [Header("雾终止距离")]
    public FloatParameter fogCutoffDistance = new FloatParameter(0.0f);
    [HideInInspector]
    // 方向光
    [Header("方向光范围系数")]
    public ClampedFloatParameter directionalInscatteringExponent = new ClampedFloatParameter(4.0f, 2.0f, 64.0f);
    [HideInInspector]
    [Header("方向光影响开始距离")]
    public FloatParameter directionalInscatteringStartDistance = new FloatParameter(0.0f);
    [HideInInspector]
    [Header("方向光颜色")]
    public ColorParameter directionalInscatteringColor = new ColorParameter(new Color(0.25f, 0.25f, 0.125f));
    [HideInInspector]
    [Header("方向光强度")]
    public ClampedFloatParameter directionalInscatteringIntensity = new ClampedFloatParameter(1.0f, 0.0f, 10.0f);

    public bool IsActive() => enable.value && (fogDensity.value > 0.0f || fogDensity2.value > 0.0f);
    public bool IsTileCompatible() => false;
}
